package com.blate.dogxiao.adapter;

import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import com.blate.dogxiao.bean.HouseBean;
import com.blate.dogxiao.databinding.ItemHomeHouseBinding;
import com.bumptech.glide.Glide;

/**
 * @author Blate
 * Created in 2021/4/20
 */
public class HomeHouseAdapter
        extends SimpleDataRecyclerViewAdapter<HouseBean, ItemHomeHouseBinding> {

    @Override
    protected ItemHomeHouseBinding onCreateBinding(LayoutInflater inflater, ViewGroup parent, int viewType) {
        return ItemHomeHouseBinding.inflate(inflater, parent, false);
    }

    @Override
    public void onBindViewHolder(@NonNull SimpleDataHolder<HouseBean, ItemHomeHouseBinding> holder, HouseBean data) {
        Glide
                .with(holder.getBinding().ivPreview)
                .load(data.preview)
                .into(holder.getBinding().ivPreview);
        holder.getBinding().tvTitle.setText(data.title);
    }

}
